<?php
/**
 * 栏目控制器
 * @author maniac
 */
namespace app\manage\controller;

use app\common\model\Columns AS ColumnsModel;
use app\common\model\Mods;
use app\common\model\MemberRoles;

class Columns extends Base
{
    /**
     * 添加/编辑补充
     * @param array $info 信息
     */
    public function addAttach($data)
    {
        $columns = ColumnsModel::field('id,parent_id,name,is_last')->order('id ASC')->select();
        $columns = recursion_one_array($columns);
        $mods    = Mods::field('id,name')->order('id ASC')->select();
        $roles   = MemberRoles::field('id,name')->order('id ASC')->select();
        $this->assign('columns', $columns);
        $this->assign('mods', $mods);
        $this->assign('roles', $roles);
    }
    
    /**
     * 管理栏目（不分页）
     */
    public function index1()
    {
        $data = ColumnsModel::field('id,parent_id,name,list_order')->order('id ASC')->select();
        $data = recursion_one_array($data);
        return $this->fetch('', [
            'data' => $data,
        ]);
    }
}
